//
//  YHWXLoginView.swift
//  SortProject
//
//  Created by ALH000355 on 2022/7/28.
//

import UIKit

class YHWXLoginView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        
        uiConfig()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func uiConfig() {
        let wxBtn = UIButton.init(type: .custom)
        let wxWidth = 44
        wxBtn.frame = CGRect(x: (Int(width) - wxWidth) / 2, y: Int(height) - wxWidth, width: wxWidth, height: wxWidth)
        wxBtn.backgroundColor = .green
        addSubview(wxBtn)
        wxBtn.addTarget(self, action: #selector(clickWxAction), for: .touchUpInside)
        
        let titleLb = UILabel.init()
        titleLb.frame = CGRect(x: (Int(width) - 80) / 2, y: 0, width: 80, height: 17)
        titleLb.textAlignment = .center
        titleLb.text = "其它方式登陆"
        titleLb.font = .systemFont(ofSize: 12)
        titleLb.textColor = .black.withAlphaComponent(0.5)
        addSubview(titleLb)
        
        let gap = 35
        let lineWidth = 34
        let leftRect = CGRect(x: Int(titleLb.left) - gap - lineWidth, y: 8, width: lineWidth, height: 1)
        let leftLine = createGrayLine(frame: leftRect)
        addSubview(leftLine)
        
        let rightRect = CGRect(x: Int(titleLb.right) + gap, y: 8, width: lineWidth, height: 1)
        let rightLine = createGrayLine(frame: rightRect)
        addSubview(rightLine)
        
    }
    @objc func clickWxAction() {
        print("clickWxAction")
    }
    
    func createGrayLine(frame: CGRect) -> UIView {
        let line = UIView.init(frame: frame)
        line.backgroundColor = colorGray244
        return line
    }
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
